

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Nelder and Mead minimisation algorithm &mdash; quippy 7ea04c5+ documentation</title>
  

  
  
    <link rel="shortcut icon" href="_static/favicon.ico"/>
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script type="text/javascript" src="_static/jquery.js"></script>
        <script type="text/javascript" src="_static/underscore.js"></script>
        <script type="text/javascript" src="_static/doctools.js"></script>
        <script type="text/javascript" src="_static/language_data.js"></script>
        <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
        <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"processClass": "math|output_area", "processEscapes": true, "ignoreClass": "document", "inlineMath": [["$", "$"], ["\\(", "\\)"]]}})</script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> quippy
          

          
            
            <img src="_static/hybrid.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
              <div class="version">
                7ea04c5+
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
    
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction to <code class="docutils literal notranslate"><span class="pre">quippy</span></code></a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation of QUIP and quippy</a></li>
<li class="toctree-l1"><a class="reference internal" href="Tutorials/index.html">Tutorials</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="quippy.html">Quippy library reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="quippy.html#core-functionality">Core functionality</a></li>
<li class="toctree-l2"><a class="reference internal" href="quippy.html#structure-generation-manipulation-and-analysis">Structure generation, manipulation and analysis</a></li>
<li class="toctree-l2"><a class="reference internal" href="quippy.html#molecular-dynamics">Molecular Dynamics</a></li>
<li class="toctree-l2"><a class="reference internal" href="quippy.html#additional-tools-for-potentials">Additional tools for Potentials</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="quippy.html#mathematical-and-optimisation-tools">Mathematical and optimisation tools</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="linearalgebra.html">Linear algebra routines</a></li>
<li class="toctree-l3"><a class="reference internal" href="quaternions.html">Quaternions and rotation</a></li>
<li class="toctree-l3"><a class="reference internal" href="spline.html">Cubic spline interpolation</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">Nelder and Mead minimisation algorithm</a><ul class="simple">
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="quippy.html#units-data-and-constants">Units, Data and Constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="quippy.html#low-level-routines-and-datatypes">Low level routines and datatypes</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="visualisation.html">Visualisation Tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="fortran_wrapper.html">Appendix: wrapping Fortran 90 Code</a></li>
<li class="toctree-l1"><a class="reference internal" href="teach_sparse.html">Command line options of the teach_sparse main program</a></li>
</ul>

            
          
    <p></p>
    <ul>
        <li><a href="genindex.html">Index</a></li>
        <li><a href="py-modindex.html">Module Index</a></li>
        <li><a href="search.html">Search Page</a></li>
        <li><a href="_modules/index.html">Module Source Code</a></li>
    </ul>
  
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">quippy</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="quippy.html">Quippy library reference</a> &raquo;</li>
        
      <li>Nelder and Mead minimisation algorithm</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/simplex.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  
<style>
/* CSS overrides for sphinx_rtd_theme */

/* 24px margin */
.nbinput.nblast,
.nboutput.nblast {
    margin-bottom: 19px;  /* padding has already 5px */
}

/* ... except between code cells! */
.nblast + .nbinput {
    margin-top: -19px;
}

.admonition > p:before {
    margin-right: 4px;  /* make room for the exclamation icon */
}

/* Fix math alignment, see https://github.com/rtfd/sphinx_rtd_theme/pull/686 */
.math {
    text-align: unset;
}
</style>
<div class="section" id="module-quippy.simplex">
<span id="nelder-and-mead-minimisation-algorithm"></span><h1>Nelder and Mead minimisation algorithm<a class="headerlink" href="#module-quippy.simplex" title="Permalink to this headline">¶</a></h1>
<p>Direct mimimisation and simulated annealing using the downhill simplex
method of Nelder and Mead.</p>
<p>Code adapted from chapter 10 of Numerical Recipes (3rd edition).</p>
<p>Module contents for <a class="reference internal" href="#module-quippy.simplex" title="quippy.simplex: Nelder and Mead minimisation algorithm"><code class="xref py py-mod docutils literal notranslate"><span class="pre">quippy.simplex</span></code></a>:</p>
<p class="rubric">Classes</p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#quippy.simplex.DownhillSimplex" title="quippy.simplex.DownhillSimplex"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DownhillSimplex</span></code></a>(func[,&nbsp;x0,&nbsp;deltas,&nbsp;p,&nbsp;args,&nbsp;…])</td>
<td>Multidimensional minimisation using the downhill simplex method of Nelder and Mead.</td>
</tr>
</tbody>
</table>
<dl class="class">
<dt id="quippy.simplex.DownhillSimplex">
<em class="property">class </em><code class="descclassname">quippy.simplex.</code><code class="descname">DownhillSimplex</code><span class="sig-paren">(</span><em>func</em>, <em>x0=None</em>, <em>deltas=None</em>, <em>p=None</em>, <em>args=None</em>, <em>ftol=1e-06</em>, <em>nmax=5000</em>, <em>tiny=1e-10</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/quippy/simplex.html#DownhillSimplex"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#quippy.simplex.DownhillSimplex" title="Permalink to this definition">¶</a></dt>
<dd><p>Multidimensional minimisation using the downhill simplex method of
Nelder and Mead.</p>
<p>From Numerical Recipes, 3rd edition, section 10.5.</p>
<p class="rubric">Methods</p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#quippy.simplex.DownhillSimplex.anneal_step" title="quippy.simplex.DownhillSimplex.anneal_step"><code class="xref py py-obj docutils literal notranslate"><span class="pre">anneal_step</span></code></a>(iter,&nbsp;temperature)</td>
<td>Anneal for <em>iter</em> steps at temperature <em>temperature</em>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#quippy.simplex.DownhillSimplex.extrapolate" title="quippy.simplex.DownhillSimplex.extrapolate"><code class="xref py py-obj docutils literal notranslate"><span class="pre">extrapolate</span></code></a>(ihi,&nbsp;yhi,&nbsp;fac[,&nbsp;temperature])</td>
<td>Extrapolate by a factor <em>fac</em> through the face of the simplex across from the high point <em>ihi</em>, try it, and replace the high point if the new point is better.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#quippy.simplex.DownhillSimplex.minimise" title="quippy.simplex.DownhillSimplex.minimise"><code class="xref py py-obj docutils literal notranslate"><span class="pre">minimise</span></code></a>()</td>
<td>Run the downhill simplex minimiser.</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="quippy.simplex.DownhillSimplex.anneal_step">
<code class="descname">anneal_step</code><span class="sig-paren">(</span><em>iter</em>, <em>temperature</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/quippy/simplex.html#DownhillSimplex.anneal_step"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#quippy.simplex.DownhillSimplex.anneal_step" title="Permalink to this definition">¶</a></dt>
<dd><p>Anneal for <em>iter</em> steps at temperature <em>temperature</em>.</p>
<p>Returns True if converged to global minimum, False otherwise.</p>
</dd></dl>

<dl class="method">
<dt id="quippy.simplex.DownhillSimplex.extrapolate">
<code class="descname">extrapolate</code><span class="sig-paren">(</span><em>ihi</em>, <em>yhi</em>, <em>fac</em>, <em>temperature=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/quippy/simplex.html#DownhillSimplex.extrapolate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#quippy.simplex.DownhillSimplex.extrapolate" title="Permalink to this definition">¶</a></dt>
<dd><p>Extrapolate by a factor <em>fac</em> through the face of the simplex
across from the high point <em>ihi</em>, try it, and replace the
high point if the new point is better. Returns result of
evaluating function at new point.</p>
</dd></dl>

<dl class="method">
<dt id="quippy.simplex.DownhillSimplex.minimise">
<code class="descname">minimise</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/quippy/simplex.html#DownhillSimplex.minimise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#quippy.simplex.DownhillSimplex.minimise" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the downhill simplex minimiser.</p>
<p>Returns coordinates at minimum as vector <em>x</em>. After minimisation,
function value at minimum is available as <em>fmin</em> attribute,
simplex as <em>p</em> attribute, and number of function evaluations as
<em>nfunc</em> attribute.</p>
</dd></dl>

</dd></dl>

</div>


           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2008-2016, James Kermode

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>